﻿using System;
using COL = System.Collections.Generic;

namespace BoresSoft.Ftp
{
	/// <summary>
	/// Class respesenting a business login exception in BoresSoft.Ftp.
	/// </summary>
	[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2240:ImplementISerializableCorrectly"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors"), Serializable]
	public class FtpException : Exception
	{
		internal FtpException(ErrorCode appCode, COL.IList<ResponseLine> ftpCode)
		{
			ApplicationError = appCode;

			if (null != ftpCode && ftpCode.Count > 0)
                FtpError = new COL.List<ResponseLine>(ftpCode);
		}

		internal FtpException(ErrorCode appCode) : this(appCode, null)
		{
		}

		/// <summary>
		/// What exactly happens.
		/// </summary>
		public ErrorCode ApplicationError
		{
			get;
			private set;
		}

		/// <summary>
		/// Collection of of responses of remote server (can be null).
		/// </summary>
        public COL.IList<ResponseLine> FtpError
        {
            get;
            private set;
        }
	}
}
